// 爬虫作业状态枚举
export type CrawlerJobStatus = 'pending' | 'running' | 'completed' | 'failed';

// 爬虫作业接口
export interface CrawlerJob {
  id: number;
  name: string;
  url: string;
  status: CrawlerJobStatus;
  progress: number;
  created_at: string;
  completed_at?: string;
  result_count: number;
  config?: {
    depth: number;
    delay: number;
    max_pages: number;
  };
}

// 爬虫结果接口
export interface CrawlerResult {
  id: number;
  job_id: number;
  url: string;
  title: string;
  content: string;
  extracted_data: Record<string, any>;
  created_at: string;
  status: 'success' | 'failed';
}

// 爬虫配置接口
export interface CrawlerConfig {
  id?: number;
  name: string;
  url: string;
  depth: number;
  delay: number;
  max_pages: number;
  selectors?: {
    title?: string;
    content?: string;
    links?: string;
  };
  created_at?: string;
  updated_at?: string;
}

// 定时任务接口
export interface ScheduledTask {
  id: number;
  name: string;
  cron_expression: string;
  crawler_config_id: number;
  enabled: boolean;
  last_run?: string;
  next_run?: string;
  created_at: string;
  updated_at: string;
}

// 通用数据列表组件的类型定义
export interface DataListProps<T> {
  items: T[];
  renderItem: (item: T) => React.ReactNode;
  keyExtractor: (item: T) => string | number;
  onRefresh?: () => void;
  loading?: boolean;
  emptyMessage?: string;
}

// 使用泛型来增强组件的可复用性
export interface GenericComponentProps<T> {
  data: T;
  onChange?: (data: T) => void;
  onError?: (error: string) => void;
  loading?: boolean;
}